package com.example.demo.config;

/**
 * @author zhaokai
 * @module s
 * @project spbaxic
 * @package com.glg.sp.config
 * @email 1107313968@qq.com
 * @date 2025-04-29 - 15:59
 */


import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class CorsConfig implements WebMvcConfigurer {
      @Override
      public void addCorsMappings(CorsRegistry registry) {
            registry.addMapping("/**")
                        .allowedOriginPatterns("*") // 列出允许的源
                        .allowedMethods("GET", "POST", "PUT", "DELETE")
                        .allowCredentials(true);
      }
}
